package cn.zmwh.manage.admin.modules.upms.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * <p>
 * 菜单管理
 * </p>
 *
 * @author dmzmwh
 * @since 2025-03-11
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_menu")
@ApiModel(value = "SysMenu对象", description = "菜单管理")
public class SysMenu implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "上级ID，一级菜单为0")
    private Long pid;

    @ApiModelProperty(value = "菜单名称")
    private String name;

    @ApiModelProperty(value = "类型  1菜单 2按钮")
    private String menuType;

    @ApiModelProperty(value = "组件路径")
    private String component;

    @ApiModelProperty(value = "排序")
    private Integer menuSort;

    @ApiModelProperty(value = "链接地址")
    private String isLink;

    @ApiModelProperty(value = "重定向	重定向	重定向")
    private String redirect;

    @ApiModelProperty(value = "路由地址")
    private String path;

//    @ApiModelProperty(value = "授权标识(多个用逗号分隔，如：sys:menu:list,sys:menu:save)")
//    private String rolesStr;

    @JsonIgnore
    @ApiModelProperty(value = "源数据")
    private String metaStr;

//    @ApiModelProperty(value = "删除标识  0：正常   1：已删除")
//    private Integer del;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SysMenu)) return false;
        SysMenu menu = (SysMenu) o;
        return Objects.equals(getName(), menu.getName()) && Objects.equals(getMenuType(), menu.getMenuType()) && Objects.equals(getPath(), menu.getPath());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getName(), getMenuType(), getPath());
    }
}
